package com.dss.auto_deploy.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dss.auto_deploy.dto.SelectDto;
import com.dss.auto_deploy.domain.Deploy;
import com.dss.auto_deploy.vo.DeployVo;

import java.io.IOException;
import java.util.List;

/**
 * @author: dongshoushan
 * @date: 2021年01月18日 16:44
 */
public interface IDeployService extends IService<Deploy> {
    /**
     * 新增配置
     *
     * @param deploy
     */
    void insertDeploy(Deploy deploy);
    public void startService(Deploy deploy,String[] split) throws IOException;
    /**
     * 修改配置
     *
     * @param deploy
     */
    void updateDeploy(Deploy deploy);

    /**
     * 删除配置
     *
     * @param id
     */
    void deleteDeploy(Long id);

    /**
     * 查询所有配置
     *
     * @param pageReq
     * @return
     */
    Page<DeployVo> getList(SelectDto pageReq);

    List<DeployVo> convertToVo(List<Deploy> records);

    /**
     * 自动批量部署代码
     * 后端
     * @param ids
     * @return
     */
    Boolean deploySelect(String ids) throws Exception;
    /**
     * 自动批量部署代码
     * 后端
     * @param ids
     * @return
     */
    Boolean restartService(String ids) throws Exception;
    /**
     * 自动批量部署代码
     * 前端
     * @return
     */
    Boolean javaScriptDeployBatch(List<Long> split) throws Exception;

    /**
     * 定时任务更新前端代码
     */
    void jobToDeployHtml(Long projectId,Long namespaceId);


    Boolean stopService(String ids) throws IOException;

    /**
     * 查询当前部署成功的数据
     * @return
     */
    List<DeployVo> getSuccess();

    void init() throws IOException;
}
